
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from meiduo_admin.paginators import MyPage
from meiduo_admin.serializers.perm_serializers import *


# 新增权限可选类型
class PermTypeListView(ListAPIView):
    queryset = ContentType.objects.all()
    serializer_class = PermTypeModelSerializer
    pagination_class = None


# 权限视图集
class PermViewSet(ModelViewSet):
    queryset = Permission.objects.all()
    serializer_class = PermModelSerializer
    pagination_class = MyPage

    def get_queryset(self):
        return self.queryset.order_by('id')